/**
 * \file  antiviral_selector.h
 * \brief Definition of Antiviral Selector class.
 *
 * ASO: Antiviral Sequence Optimizer
 * <http://aso.googlecode.com/>
 * Copyright (C) 2010 Velez Ezequiel, Peralta Andres, FuDePAN
 *
 * This file is part of the ASO project.
 *
 * Contents:       Header file for ASO providing class Antiviral.
 *
 * System:         ASO
 * Language:       C++
 *
 * Author:         Velez Ezequiel, Peralta Andres
 * E-Mail:
 *
 * ASO is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * ASO is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ASO.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
#ifndef ANTIVIRAL_SELECTOR_H
#define ANTIVIRAL_SELECTOR_H

#include "aso-core/data_base.h"
#include "aso-core/optimized_container.h"
#include "aso-core/antiviral_set.h"

class AntiviralSelector
{
public:
    void select_antivirals(const AntiviralSet& antiviral_set, const biopp::PseudoNucSequence& sequence, AntiviralSet& applicable_avs);
};

/* Selecciona los antivirales que aplican del conjunto antiviral_set y que tienen distancia maxima */
inline void AntiviralSelector::select_antivirals(const AntiviralSet& antiviral_set, const biopp::PseudoNucSequence& sequence, AntiviralSet& applicable_avs)
{
    /* iterador hacia los antivirales disponibles */
    AVIterator it(antiviral_set.antivirals);

    OptimizedContainer<Avs, biopp::NucDistance, MaximumValues, NotIncludingZero> keepMaxValue(applicable_avs.antivirals, biopp::NucDistance(0));

    while (!it.end())
    {
        /* distancia que tiene el antiviral al que esta apuntando el iterador */
        const biopp::NucDistance distance = (*it)->applies(sequence);
        keepMaxValue.add(*it, distance);
        ++it;
    }
}

#endif
